<template>
	<view class="container">
		<view class="dl">
			<view class="dt">
				<image src="/static/images/WechatIMG832.png" class="bg" mode=""></image>
				<view class="p">
					输入邀请码
				</view>
			</view>
			
			<view class="dd">
				<input class="input" type="text" v-model="invite" placeholder="请输入邀请码" />
			</view>
		</view>
		
		<button class="btn" @click="onSubmitClick">
			<text>提交</text>
		</button>
	</view>
</template>

<script>
	import {
		JSMRequest
	} from '@/module/api'
	
	const _ = require("@/libs/underscore/underscore-min.js")._
	
	export default {
		data() {
			return {
				invite: ""
			};
		},
		
		computed: {
			userInfo () {
				return this.$store.state.userInfo
			},
		},
		
		methods: {
			onResetClick () {
				this.remark = ""
			},
			
			onSubmitClick () {
				let _t = this
				
				if(this.invite == "" ) return false
				
				uni.showLoading({
					mask: true,
					title: '请求中...'
				})
				
				JSMRequest({
					tag: "jsm-user-set-parent",
					method: "POST",
					params: {
						invite: this.invite
					}
				}).then(() => {
					uni.hideLoading()
					uni.reLaunch({
						url: "/pages/index/index"
					})
				}).catch(e => {
					uni.hideLoading()
					uni.showToast({
						icon: "none",
						title: e.msg
					})
				})
			}
		}
	}
</script>

<style lang="less" scoped>
	.dl{
		
		.dt{
			position: relative;
			
			.bg{
				height: 406px;
				width: 100%;
			}
			
			.p{
				font-size: 48px;
				color: #fff;
				position: absolute;
				display: flex;
				align-items: center;
				justify-content: center;
				top: 0;
				bottom: 0;
				right: 0;
				left: 0;
			}
		}
		
		.dd{
			background: #FFFFFF;
			margin-top: 50px;
			
			
			
			.input{
				margin: 0 auto;
				width: 690px;
				height: 100px;
				box-sizing: border-box;
				padding: 0 30px;
				font-size: 30px;
				color: #333333;
				border-radius: 50px;
				background: #F1F1F1;
			}
		}
	}
	
	.btn{
		background: #FF3660;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 50px;
		height: 100px;
		font-size: 30px;
		color: #FFFFFF;
		margin: 80px auto 0;
		width: 660px;
	}
</style>
